virtual_list
Since
0.9.0
Functions
Generate a textual representation of this iterable.
An optional separator, prefix and postfix can be provided. One can also provide a limit: integer?
. If there are more elements in the result than limit
, the elements whose indices exceed limit
are omitted, and the passed truncated: text
is included instead.
Examples:
[1, 2, 3].join_to_text()
returns'1, 2, 3'
.[1, 2, 3].join_to_text('_')
returns'1_2_3'
.[1, 2, 3].join_to_text('*', '(', ')')
returns'(1*2*3)'
.list<T>().join_to_text('!', '(', ')')
returns'()'
(whereT
is a valid type).range(10).join_to_text('', '', '', 5)
returns'01234...'
.range(10).join_to_text('', '', '', 5, 'more')
returns'01234more'
.
Where the function even
is defined:
function even(x: integer): text {
return if (x % 2 == 0) 'EVEN' else 'ODD';
}
Then:
range(10).join_to_text('->', '{', '}', 5, '...', even(*))
returns{EVEN->ODD->EVEN->ODD->EVEN->...}
.